const main = {
  add: `INSERT INTO Notice
    (title, content, userId, isTop) VALUES
    (?, ?, ?, ?)`,
  update: `UPDATE Notice SET
    title = ?,
    content = ?,
    isTop = ?
    WHERE id = ?`,
  select: `SELECT n.*, u.familyName, u.lastName, u.avatar 
    FROM Notice n
    LEFT JOIN User u ON u.id = n.userId
    ORDER BY isTop DESC, createTime DESC
    LIMIT ?, ?`,
  count: `SELECT COUNT(*) AS total FROM Notice`,
  delete: `DELETE FROM Notice WHERE id = ?`
};

module.exports = main;